/*
 * $Id: ExchangeResolverTests.m 249 2008-09-09 13:58:25Z jon $
 * Sleeper
 *
 * Created by Jon Gordon on 1/1/08
 * Copyright Jon Gordon.  All rights reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining 
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including 
 * without limitation the rights to use, copy, modify, merge, publish, 
 * distribute, sublicense, and/or sell copies of the Software, and to 
 * permit persons to whom the Software is furnished to do so, subject to 
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */


#import "ExchangeResolverTests.h"

#import "QEExchangeElement.h"
#import "QEExchangeResolver.h"

@implementation ExchangeResolverTests
- (void)testCreateAndDestroy
{
    QEExchangeResolver *resolver = [[QEExchangeResolver alloc] init];
    STAssertNotNil(resolver, @"failed to allocate or initialize instance of QEExchangeResolver");
    [resolver release];
} // testCreateAndDestroy

- (void)testSimpleExchange
{
    QEExchangeResolver *resolver = [[QEExchangeResolver alloc] init];
    STAssertNotNil(resolver, @"failed to allocate or initialize instance of QEExchangeResolver");
    
    NSString *exchange = @"14250 nr102 a w1yu 67 ct";
    STAssertTrue([resolver resolveExchange:exchange], @"failed to recognize valid exchange: \"%@\"", exchange);
    
    [resolver release];
} // testSimpleExchange

- (void)testProgressiveExchange
{
    QEExchangeResolver *resolver = [[QEExchangeResolver alloc] init];
    STAssertNotNil(resolver, @"failed to allocate or initialize instance of QEExchangeResolver");
    NSString *exchange = @" 14250 aa1yu q 72 ct 143 floop";
    unsigned int exchLength = [exchange length];
    unsigned int partialLength;
    BOOL result;
    NSString *partialExchange;
    NSDictionary *mappings;
    id mappedToken;
    
    for (partialLength = 0; partialLength <= exchLength; ++partialLength) {
        partialExchange = [exchange substringToIndex:partialLength];
        result = [resolver resolveExchange:partialExchange];
        mappings = [resolver resolvedElements];
        
        if (partialLength <= [@" " length]) {
            NSLog(@"*** test section 1");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNil(mappedToken, @"mappings improperly included callsign: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNil(mappedToken, @"mappings improperly included frequency: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNil(mappedToken, @"mappings improperly included precedence: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNil(mappedToken, @"mappings improperly included section: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"serial"];
            STAssertNil(mappedToken, @"mappings improperly included serial: \"%@\"", mappedToken);
        } else if (partialLength <= [@" 14" length]) {
            NSLog(@"*** test section 2");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNil(mappedToken, @"mappings improperly included callsign: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNil(mappedToken, @"mappings improperly included frequency: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNil(mappedToken, @"mappings improperly included precedence: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNil(mappedToken, @"mappings improperly included section: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"serialRcvd"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted serial");
            if (nil != mappedToken) {
                STAssertTrue([@"14" hasPrefix:[resolver sourceTokenForResolvedElement:mappedToken]], @"token \"%@\" improperly assigned to serial", mappedToken);
            } // if
        } else if (partialLength <= [@" 14250 " length]) {
            NSLog(@"*** test section 3");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNil(mappedToken, @"mappings improperly included callsign: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertTrue([@"14250" hasPrefix:[resolver sourceTokenForResolvedElement:mappedToken]], @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNil(mappedToken, @"mappings improperly included precedence: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNil(mappedToken, @"mappings improperly included section: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"serial"];
            STAssertNil(mappedToken, @"mappings improperly included serial: \"%@\"", mappedToken);
        } else if (partialLength <= [@" 14250 a" length]) {
            NSLog(@"*** test section 4");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNil(mappedToken, @"mappings improperly included callsign: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted precedence");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"A", mappedToken, @"token \"%@\" improperly assigned to precedence", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNil(mappedToken, @"mappings improperly included section: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"serial"];
            STAssertNil(mappedToken, @"mappings improperly included serial: \"%@\"", mappedToken);
        } else if (partialLength <= [@" 14250 aa1" length]) {
            NSLog(@"*** test section 5");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNil(mappedToken, @"mappings improperly included callsign: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNil(mappedToken, @"mappings improperly included precedence: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNil(mappedToken, @"mappings improperly included section: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"serial"];
            STAssertNil(mappedToken, @"mappings improperly included serial: \"%@\"", mappedToken);
        } else if (partialLength <= [@" 14250 aa1yu " length]) {
            NSLog(@"*** test section 6");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted callsign");
            if (nil != mappedToken) {
                STAssertTrue([@"aa1yu" hasPrefix:[resolver sourceTokenForResolvedElement:mappedToken]], @"token \"%@\" improperly assigned to callsign", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNil(mappedToken, @"mappings improperly included precedence: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNil(mappedToken, @"mappings improperly included section: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"serial"];
            STAssertNil(mappedToken, @"mappings improperly included serial: \"%@\"", mappedToken);
        } else if (partialLength <= [@" 14250 aa1yu q " length]) {
            NSLog(@"*** test section 7");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted callsign");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"AA1YU", mappedToken, @"token \"%@\" improperly assigned to callsign", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted precedence");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"Q", mappedToken, @"token \"%@\" improperly assigned to precedence", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNil(mappedToken, @"mappings improperly included section: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"serial"];
            STAssertNil(mappedToken, @"mappings improperly included serial: \"%@\"", mappedToken);
        } else if (partialLength <= [@" 14250 aa1yu q 72 c" length]) {
            NSLog(@"*** test section 8");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted callsign");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"AA1YU", mappedToken, @"token \"%@\" improperly assigned to callsign", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted precedence");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"Q", mappedToken, @"token \"%@\" improperly assigned to precedence", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNil(mappedToken, @"mappings improperly included section: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"serialRcvd"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted serial");
            if (nil != mappedToken) {
                STAssertTrue([@"72" hasPrefix:[resolver sourceTokenForResolvedElement:mappedToken]], @"token \"%@\" improperly assigned to serial", mappedToken);
            } // if
        } else if (partialLength <= [@" 14250 aa1yu q 72 ct " length]) {
            NSLog(@"*** test section 9");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted callsign");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"AA1YU", mappedToken, @"token \"%@\" improperly assigned to callsign", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNil(mappedToken, @"mappings improperly included check: \"%@\"", mappedToken);
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted precedence");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"Q", mappedToken, @"token \"%@\" improperly assigned to precedence", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted section");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"CT", mappedToken, @"token \"%@\" improperly assigned to section",  mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"serialRcvd"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted serial");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithInt:72], mappedToken, @"token \"%@\" improperly assigned to serial", mappedToken);
            } // if
        } else if (partialLength <= [@" 14250 aa1yu q 72 ct 1" length]) {
            NSLog(@"*** test section 10");
            STAssertTrue(result, @"failed to accept valid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted callsign");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"AA1YU", mappedToken, @"token \"%@\" improperly assigned to callsign", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted check");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"72", mappedToken, @"token \"%@\" improperly assigned to check", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted precedence");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"Q", mappedToken, @"token \"%@\" improperly assigned to precedence", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted section");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"CT", mappedToken, @"token \"%@\" improperly assigned to section",  mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"serialRcvd"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted serial");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithInt:1], mappedToken, @"token \"%@\" improperly assigned to serial", mappedToken);
            } // if
        } else if (partialLength <= [@" 14250 aa1yu q 72 ct 14" length]) {
            NSLog(@"*** test section 11");
            STAssertTrue(result, @"failed to accept valid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted callsign");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"AA1YU", mappedToken, @"token \"%@\" improperly assigned to callsign", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted check");
            if (nil != mappedToken) {
                STAssertTrue([@"14" hasPrefix:[resolver sourceTokenForResolvedElement:mappedToken]], @"token \"%@\" improperly assigned to check", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted precedence");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"Q", mappedToken, @"token \"%@\" improperly assigned to precedence", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted section");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"CT", mappedToken, @"token \"%@\" improperly assigned to section",  mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"serialRcvd"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted serial");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithInt:72], mappedToken, @"token \"%@\" improperly assigned to serial", mappedToken);
            } // if
        } else if (partialLength <= [@" 14250 aa1yu q 72 ct 143 " length]) {
            NSLog(@"*** test section 12");
            STAssertTrue(result, @"failed to accept valid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted callsign");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"AA1YU", mappedToken, @"token \"%@\" improperly assigned to callsign", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted check");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"72", mappedToken, @"token \"%@\" improperly assigned to check", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted precedence");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"Q", mappedToken, @"token \"%@\" improperly assigned to precedence", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted section");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"CT", mappedToken, @"token \"%@\" improperly assigned to section",  mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"serialRcvd"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted serial");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithInt:143], mappedToken, @"token \"%@\" improperly assigned to serial", mappedToken);
            } // if
        } else {
            NSLog(@"*** test section 13");
            STAssertFalse(result, @"failed to reject invalid exchange: \"%@\"", partialExchange);
            STAssertNotNil(mappings, @"non-nil string is supposed to produce non-nil dictionary of resolved elements");
            mappedToken = [mappings objectForKey:@"call"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted callsign");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"AA1YU", mappedToken, @"token \"%@\" improperly assigned to callsign", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"check"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted check");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"72", mappedToken, @"token \"%@\" improperly assigned to check", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"freq"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted frequency");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithFloat:14.25], mappedToken, @"token \"%@\" improperly assigned to frequency", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"prec"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted precedence");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"Q", mappedToken, @"token \"%@\" improperly assigned to precedence", mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"section"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted section");
            if (nil != mappedToken) {
                STAssertEqualObjects(@"CT", mappedToken, @"token \"%@\" improperly assigned to section",  mappedToken);
            } // if
            mappedToken = [mappings objectForKey:@"serialRcvd"];
            STAssertNotNil(mappedToken, @"mappings improperly omitted serial");
            if (nil != mappedToken) {
                STAssertEqualObjects([NSNumber numberWithInt:143], mappedToken, @"token \"%@\" improperly assigned to serial", mappedToken);
            } // if
        } // else
    } // for
    
    [resolver release];
} // testProgressiveExchange
@end
